using System;
using Voodoo.GameOps;
using Voodoo.Pattern;

public class SkinContainer : BaseContainer<SkinContainer>
{
	public SkinUnlockPopUp UnlockPopUp;

	private void Start()
	{
		SingletonMB<SkinContainer>.Instance.Fill();
		foreach (BuyButton buyButton in buyButtons)
		{
			buyButton.HideActiveIcon();
		}
		buyButtons[base.ActiveBtn].ShowActiveIcon();
	}

	public override void Fill()
	{
		content.gameObject.SetActive(value: true);
		backBtn.gameObject.SetActive(value: true);
		eshopBtn.gameObject.SetActive(value: true);
		SingletonMB<ShopButtonGroup>.Instance.SkinButton.SwitchNotification(itemAvailable: false);
		for (int i = 0; i < buyButtons.Count; i++)
		{
			buyButtons[i].Fill(DisplayItems[i]);
			BuyButton buyButton = buttonPrefab;
			buyButton.OnClicked = (Action)Delegate.Combine(buyButton.OnClicked, new Action(OnClicked));
			if (!Preloader.ShopConfig.ShopMissions && InventoryManager.Instance.HasInventory(DisplayItems[i]) && InventoryManager.Instance.CurrentBalance() >= (float)InventoryManager.Instance.GetPrice(DisplayItems[i]))
			{
				SingletonMB<ShopButtonGroup>.Instance.SkinButton.SwitchNotification(itemAvailable: true);
			}
		}
		Hide();
	}

	public override void OnClicked()
	{
		base.OnClicked();
		Refresh();
		SingletonMB<GameManager>.Instance.currentOilUI.UpdateValues();
	}

	public override void Refresh()
	{
		base.Refresh();
		SingletonMB<ShopButtonGroup>.Instance.SkinButton.SwitchNotification(itemAvailable: false);
		for (int i = 0; i < buyButtons.Count && i < DisplayItems.Count; i++)
		{
			buyButtons[i].Fill(DisplayItems[i]);
			Item item = DisplayItems[i];
			if (InventoryManager.Instance.HasInventory(item) && InventoryManager.Instance.CurrentBalance() >= (float)InventoryManager.Instance.GetPrice(item))
			{
				SingletonMB<ShopButtonGroup>.Instance.SkinButton.SwitchNotification(itemAvailable: true);
			}
		}
	}
}
